Skip to content

test(serve): drain upstream cleanup before synctest teardown - #178

Merged
tenequm merged 1 commit into
mainfrom
fix/viewer-ticket-test-leak
Nov 6, 2026
Merged

tenequm merged 1 commit into
mainfrom
fix/viewer-ticket-test-leak

Conversation

@tenequm

@tenequm tenequm commented Nov 6, 2026

Copy link
Copy Markdown
Member

The viewer ticket lifecycle test could end its synctest bubble while an asynchronous upstream session DELETE was still running. In the failed CI attempt, the blocked stack runs from aggregator.reset.func1 through ClientSession.Close into the HTTP transport. The SDK bounds this DELETE to five seconds, but fake time no longer advances after the bubble's main goroutine exits.

Add a synctest harness cleanup that closes the remote and drains runnable goroutines before the fake upstream server is torn down. Use it in every MCP harness test inside a synctest bubble. This changes only test cleanup, with no added sleeps or retries.

Validation:

  • Before: 200 race-enabled lifecycle runs passed at GOMAXPROCS=3; the CPU 1,2,4 matrix reproduced the panic on iteration 2.
  • After: 200 race-enabled lifecycle runs passed at GOMAXPROCS=3, plus 200 per CPU setting in the 1,2,4 matrix.
  • All sibling synctest tests passed 200 race-enabled runs per CPU setting (1,2,4).
  • GOMAXPROCS=3 TMPDIR=/tmp/cuttle-flake just check passed; commit hooks also passed.

Release notes

Fix intermittent viewer ticket test deadlocks by finishing asynchronous session cleanup before the fake upstream shuts down. No runtime changes or user action required.

@tenequm
tenequm merged commit cdba005 into main Nov 6, 2026
9 checks passed
@tenequm
tenequm deleted the fix/viewer-ticket-test-leak branch November 6, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant